home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 18 / Silicon_Graphics_hot mix 18.iso / netresults / jvm / solaris / jdk1.1.3 / bin / javaverify_g < prev    next >
Encoding:
Korn shell script  |  1998-02-14  |  3.1 KB  |  97 lines

  1. #! /bin/ksh
  2. #
  3. #     @(#)java_wrapper.sh    1.29 97/05/14
  4. #
  5. #===================================================================
  6. # THIS SCRIPT AND JAVA WILL NOT RUN UNDER SUNOS4.X, AKA SOLARIS 1.X.  
  7. #===================================================================
  8.  
  9. # Set up default variable values if not supplied by the user.
  10.  
  11. PRG=`whence $0` >/dev/null 2>&1
  12. J_HOME=`dirname $PRG`/..
  13. progname=`basename $0`
  14.  
  15. # The default THREADS_TYPE is "green_threads".  To change the default change
  16. # the setting of the DEFAULT_THREADS_FLAG variable.  The only valid values 
  17. # of that variable are 'green' and 'native'. 
  18. # This introduces a dependency of this wrapper on the policy used to do builds.
  19. # e.g. the usage of the name "green_threads" here is dependent on the build
  20. # scripts which use the same name. Since this is somewhat analogous to the
  21. # wrapper already depending on the build scripts putting the executable in
  22. # a specific place (JAVA_HOME/bin/`uname -p`), the new dependency does not
  23. # seem all that bad.
  24.  
  25. DEFAULT_THREADS_FLAG=green
  26.  
  27. if [[ ${THREADS_FLAG:-${DEFAULT_THREADS_FLAG}} = native ]] ; then 
  28.     THREADS_TYPE=native_threads
  29. else
  30.     THREADS_TYPE=green_threads
  31. fi
  32. export THREADS_TYPE
  33. #echo "Using executables built for $THREADS_TYPE"
  34.  
  35. #
  36. # If the -noenv argument is specified, we set JAVA_HOME
  37. # and CLASSPATH to nothing, effectively ignoring those
  38. # environment variables.
  39. #
  40. # If one of java's '-*' options was specified on the command line,
  41. # then ksh insists on trying to interpret the option when
  42. # we do a set.  Worse, it swallows the option, refusing
  43. # to pass it on to (binary) java.  So we keep track of
  44. # all options and pass them on to eval by hand.
  45. #
  46. # Search for '-native' or '-green' flags, and remove them from the
  47. # arguments if found.  Also if found, set THREADS_TYPE to either
  48. # 'native_threads' or 'green_threads', as appropriate.  This is an
  49. # alternative to using the THREADS_FLAG environment variable to 
  50. # specify the threads package for Solaris.
  51. # On the off chance someone wants to pass -green or -native to
  52. # a java program, we stop searching on the first arg that doesn't
  53. # start with a runtime-option-specifying hyphen, '-'.
  54.  
  55. for a in "$@"; do
  56.     case $a in
  57.     -native)
  58.         THREADS_TYPE=native_threads
  59.         ;;
  60.     -green)
  61.         THREADS_TYPE=green_threads
  62.         ;;
  63.     -*) ;;
  64.         *) break;
  65.     esac
  66. done
  67.  
  68. if [ -z "$JAVA_HOME" ] ; then
  69.     export JAVA_HOME
  70.     JAVA_HOME=$J_HOME
  71. fi
  72.  
  73. CLASSPATH="${CLASSPATH-.}"
  74. if [ -z "${CLASSPATH}" ] ; then
  75.     CLASSPATH="$JAVA_HOME/classes:$JAVA_HOME/lib/classes.jar:$JAVA_HOME/lib/rt.jar:$JAVA_HOME/lib/i18n.jar:$JAVA_HOME/lib/classes.zip"
  76. else
  77.     CLASSPATH="$CLASSPATH:$JAVA_HOME/classes:$JAVA_HOME/lib/classes.jar:$JAVA_HOME/lib/rt.jar:$JAVA_HOME/lib/i18n.jar:$JAVA_HOME/lib/classes.zip"
  78. fi
  79.  
  80. export CLASSPATH
  81.  
  82. LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$JAVA_HOME/lib/`uname -p`/$THREADS_TYPE"
  83. export LD_LIBRARY_PATH
  84.  
  85.       
  86. prog=$JAVA_HOME/bin/`uname -p`/${THREADS_TYPE}/${progname}
  87.  
  88. if [ -f $prog ]
  89. then
  90.      exec $DEBUG_PROG $prog $opts "$@"
  91. else
  92.     echo >&2 "$progname was not found in ${prog}"
  93.     exit 1
  94. fi
  95.